﻿''' <summary>
''' Contains the result data for a processed command line, as well as a reference to the command line processed.
''' </summary>
''' <remarks></remarks>
Public Class CommandResult
    Private _Id As Guid
    Public ReadOnly Property Id As Guid
        Get
            Return _Id
        End Get
    End Property

    Private _CommandLine As CommandLine
    Public ReadOnly Property CommandLine As CommandLine
        Get
            Return _CommandLine
        End Get
    End Property

    Protected Friend _ErrorText As String
    Public ReadOnly Property ErrorText As String
        Get
            Return _ErrorText
        End Get
    End Property

    Public ReadOnly Property IsError As Boolean
        Get
            Return _ErrorText.Length > 0
        End Get
    End Property

    Protected Friend _Log As New List(Of LogEntry)
    Public ReadOnly Property LogEntries As LogEntry()
        Get
            Return _Log.ToArray
        End Get
    End Property

    Protected Friend _ResultText As String
    Public ReadOnly Property ResultText As String
        Get
            Return _ResultText
        End Get
    End Property

    Private _TimeStamp As Date
    Public ReadOnly Property TimeStamp As Date
        Get
            Return _TimeStamp
        End Get
    End Property

    Protected Friend Sub New(line As CommandLine)
        _Id = Guid.NewGuid
        _CommandLine = line
        _ErrorText = String.Empty
        _ResultText = String.Empty
    End Sub

    Protected Friend Sub Stamp()
        _TimeStamp = Now
    End Sub

End Class